package cn.yr.blog.aop;

import cn.yr.search.api.ArticleSearchApi;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
/**
 * @author lang 1102076808@qq.com
 * @Description 
 * @Date 18:03 2021/6/25
 **/
@Aspect
@Component
public class ElasticsearchAcpect {
    @Resource
    private ArticleSearchApi articleSearchApi;

    /**
     * 定义一个切点
     */
    @Pointcut("@annotation(cn.yr.blog.aop.ElasticsearchHandle)")
    public void cutOffPoint() {

    }

    @Around("cutOffPoint()")
    public void around(ProceedingJoinPoint pjp){
        MethodSignature signature = (MethodSignature) pjp.getSignature();
        ElasticsearchHandle elasticsearchHandle = signature.getMethod().getDeclaredAnnotation(ElasticsearchHandle.class);
        String value = elasticsearchHandle.value();
    }

    public void handle(String value){


    }
}
